package com.force.module.mcpclient.service.impl;

import cn.hutool.core.thread.ThreadUtil;
import com.force.langchain4j.filesource.FileBaseLoader;
import lombok.SneakyThrows;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.concurrent.Future;

@Service
public class FileServiceImpl implements IFileService{
    @Override
    public String dealWithFile(String filePath) {
        return null;
    }

    @SneakyThrows
    @Override
    public Object dealWithFile(final MultipartFile filePath) throws IOException {
        Future<Object> stringFuture = ThreadUtil.execAsync(() -> {
	        Object load = FileBaseLoader.load(filePath);
	        return load;
        });
        return stringFuture.get();
    }

}
